<?php


namespace App\Extensions\Actions\Upload;

use Illuminate\Http\Request;
use Encore\Admin\Actions\Response;
use App\Extensions\Actions\RowAction;

class CertUploadAction extends RowAction
{
    public $name = '授权后证书上传';

    public function handle($model, Request $request): Response
    {
        $model->storeFile($request->file('cert'),'cert',null,[
            'cert_date'=>$request->get('cert_date')
        ]);
        return $this->response()->success('操作成功')->refresh();
    }

    public function form()
    {
        $this->date('cert_date', __('下证时间'))->required();
        $this->file('cert', '上传证书')->required();
    }

}
